/***
 * Brian Hession -- February 15, 2013
 * 
 * Render
 *
 * Changelog
 * Date				Changes
 * 2/15/2013		Initial version
 * 2/22/2013		Got rid of class - added refresh() and scaleImage()
 *
 */

#include "graphics.h"

bool Graphics::refresh( SDL_Surface* screen ) {
	if( SDL_Flip( screen ) == -1 )
		return false;
	return true;
}

SDL_Surface* Graphics::loadImage( const char* filename ) {
	SDL_Surface* loadedImage = NULL;
	SDL_Surface* optimizedImage = NULL;
	loadedImage = IMG_Load( filename );
	if( loadedImage != NULL ) {
		optimizedImage = SDL_DisplayFormatAlpha( loadedImage );
		SDL_FreeSurface( loadedImage );
	}
	return optimizedImage;
}

void Graphics::applySurface( SDL_Rect* offset, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip ) {
	SDL_BlitSurface( source, clip, destination, offset );
}

SDL_Surface* Graphics::scaleImage( SDL_Surface* image, float scale, int type ) {
	return zoomSurface( image, scale, scale, type );
}

